package com.chat.datea.fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.chat.datea.R;
import com.chat.datea.base.BaseFragment;
import com.chat.datea.utils.fragment.ReplaceFragment;


/**
 * Created by xyb on 15/10/20.
 */
public class UserCenterFragment extends BaseFragment implements View.OnClickListener {
    private RelativeLayout rl;
    private LinearLayout local, download;


    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {
        rl = (RelativeLayout) view.findViewById(R.id.rl);
        local = (LinearLayout) view.findViewById(R.id.local);
        download = (LinearLayout) view.findViewById(R.id.download);
        rl.setOnClickListener(this);
        download.setOnClickListener(this);
        local.setOnClickListener(this);

    }

    @Override
    protected View inflaterView(LayoutInflater inflater, ViewGroup container) {
        view = inflater.inflate(R.layout.fragment_usercenter, null);
        return view;
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.rl:
                UserCollectFragment userCollectFragment = new UserCollectFragment();
                new ReplaceFragment(userCollectFragment, getActivity().getSupportFragmentManager(),
                        R.id.fl_content, true, null);
                break;
            case R.id.local:
                LocalSongFragment songFragment = new LocalSongFragment();
                new ReplaceFragment(songFragment, getActivity().getSupportFragmentManager(),
                        R.id.fl_content, true, null);
                break;
            case R.id.download:
                HistoryDetails historyDetails = new HistoryDetails();
                new ReplaceFragment(historyDetails, getActivity().getSupportFragmentManager(),
                        R.id.fl_content, true, null);
                break;
        }
    }

}
